from flask import g,jsonify


def login(func):
    def werper(*args,**kwargs):

        if g.user_id == 0:
            return jsonify({
                'msg':'用户未登录！',
                'code':403
            })
        return func(*args,**kwargs)
    return werper